package com.jiutong.meipenggang.http.present;

import android.content.Context;
import android.util.Log;

import com.jiutong.meipenggang.common.Constants;
import com.jiutong.meipenggang.entity.BaseBean;
import com.jiutong.meipenggang.entity.MeiLiCaiBean;
import com.jiutong.meipenggang.http.model.interfaces.BaseBiz;
import com.jiutong.meipenggang.http.model.interfaces.InvestMoneyBiz;
import com.jiutong.meipenggang.http.model.requests.MeiLiCaiFragmentRequest;
import com.jiutong.meipenggang.http.subscribers.ProgressSubscriber;
import com.jiutong.meipenggang.http.subscribers.SubscriberOnNextListener;
import com.jiutong.meipenggang.utils.SpConfig;
import com.jiutong.meipenggang.utils.TimeUitl;
import com.orhanobut.logger.Logger;

import java.sql.Time;
import java.util.HashMap;

/**
 * @author Veken
 * @date on 2017/12/19 9:57
 * @describe
 */

public class MeiLiCaiInfoPresent {

    private Context mContext;
    private MeiLiCaiFragmentRequest meiLiCaiFragmentRequest;
    private BaseBiz baseBiz;

    public MeiLiCaiInfoPresent(Context mContext, BaseBiz baseBiz) {
        this.mContext = mContext;
        this.baseBiz = baseBiz;
        meiLiCaiFragmentRequest = new MeiLiCaiFragmentRequest();
    }

    /**
     * 获取美理财frament信息
     */
    public void getMeiLiCaiFragmentInfo(){
        SubscriberOnNextListener onNextListener = new SubscriberOnNextListener<MeiLiCaiBean>() {
            @Override
            public void onNext(MeiLiCaiBean object) {
                baseBiz.onSuccess(object);
//                Logger.d("TAG",object.toString());
            }
            @Override
            public void onError(Throwable e) {
                baseBiz.onError(e);
            }
        };
        HashMap<String,Object> fieldMap = new HashMap<>();
        fieldMap.put("OPT",baseBiz.getOpt());
        fieldMap.put("timestamp", TimeUitl.getDate());
        fieldMap.put("currPage","1");
        meiLiCaiFragmentRequest.getMeiLiCaiFragmentInfo(new ProgressSubscriber(onNextListener,mContext),fieldMap);
    }



}
